﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddOrEditImageCategory.aspx.cs"
    Inherits="admin_Modules_NewsEvent_Images_AddOrEditImageCategory" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="/admin/resources/js/base.js" type="text/javascript"></script>
    <script src="/plugins/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="/plugins/ckfinder/ckfinder.js" type="text/javascript"></script>
    <script src="/plugins/ckfinder/config.js" type="text/javascript"></script>
    <script language="javascript">
        function BrowseServer() {
            // You can use the "CKFinder" class to render CKFinder in a page:
            var finder = new CKFinder();
            finder.basePath = '/plugins/ckfinder/'; // The path for the installation of CKFinder (default = "/ckfinder/").
            finder.selectActionFunction = SetFileField;
            finder.popup();
        }


        // This is a sample function which is called when a file is selected in CKFinder.
        function SetFileField(fileUrl) {
            triggerImage.setValue(fileUrl);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager runat="server" ID="SM">
    </ext:ResourceManager>
    <ext:Viewport ID="wdAddOrEditImageCategory" runat="server" Layout="BorderLayout">
        <Items>
            <ext:Panel Region="Center" BodyStyle="backgound-color:#fff;" BodyBorder="true">
                <Items>
                    <ext:FormPanel ID="StatusForm" runat="server" Border="false" BodyStyle="padding:5px">
                        <Items>
                            <ext:FormLayout ID="FormLayout1" runat="server">
                                <Anchors>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextField runat="server" ID="txtTitle" Width="300" FieldLabel="Tiêu đề" AllowBlank="false"
                                            EmptyText="Tiêu đề" BlankText="Tiêu đề không được để trống">
                                        </ext:TextField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TextArea runat="server" ID="txtDescription" Width="300" Height="50" FieldLabel="Diễn tả">
                                        </ext:TextArea>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:NumberField ID="txtOrder" runat="server" Width="100" FieldLabel="Thứ thự"
                                            Text="0">
                                        </ext:NumberField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="95%">
                                        <ext:TriggerField ID="triggerImage" FieldLabel="Ảnh tỏm tắt" runat="server" EmptyText="Ảnh tóm tắt"
                                            AllowBlank="true" Editable="false">
                                            <Listeners>
                                                <TriggerClick Handler="BrowseServer();" />
                                                <Focus Handler="BrowseServer();" />
                                            </Listeners>
                                            <Triggers>
                                                <ext:FieldTrigger Icon="Ellipsis" />
                                            </Triggers>
                                        </ext:TriggerField>
                                    </ext:Anchor>
                                </Anchors>
                            </ext:FormLayout>
                        </Items>
                        <TopBar>
                            <ext:Toolbar ID="Toolbar2" runat="server">
                                <Items>
                                    <ext:Button Icon="Disk" Text="Cập nhật">
                                        <DirectEvents>
                                            <Click OnEvent="SaveImageCategories" Before="valid = #{StatusForm}.getForm().isValid(); if(valid){ Ext.Msg.wait('Đang cập nhật dữ liêu...', 'Saving'); } return valid;"
                                                Success="closeWindow();">
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:ToolbarSeparator>
                                    </ext:ToolbarSeparator>
                                    <ext:Button Icon="ArrowUndo" Text="Hủy bỏ">
                                        <Listeners>
                                            <Click Handler="wdAddOrEditImageCategory.hide();" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                    </ext:FormPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
